]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensions-tool: Fix security warnings about format string injection
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Tue, 24 Jun 2025 06:59:21 +0000 (14:59 +0800)
committerDaniel van Vugt <daniel.van.vugt@canonical.com>
Tue, 24 Jun 2025 06:59:21 +0000 (14:59 +0800)
Fixes:
```
../subprojects/extensions-tool/src/command-upload.c: In function ‘response_get_token’:
../subprojects/extensions-tool/src/command-upload.c:126:7: warning: format not a string literal and no format arguments [-Wformat-security]
  126 |       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, msg);
      |       ^~~~~~~~~~~
../subprojects/extensions-tool/src/command-upload.c: In function ‘session_get_login_token’:
../subprojects/extensions-tool/src/command-upload.c:294:20: warning: format not a string literal and no format arguments [-Wformat-security]
  294 |                    detail ? detail : soup_status_get_phrase (status));
      |                    ^~~~~~
../subprojects/extensions-tool/src/command-upload.c: In function ‘session_upload_file’:
../subprojects/extensions-tool/src/command-upload.c:357:20: warning: format not a string literal and no format arguments [-Wformat-security]
  357 |                    detail ? detail : soup_status_get_phrase (status));
      |                    ^~~~~~
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3764>

subprojects/extensions-tool/src/command-upload.c

index d427f7cdb9c342acb75bb4a908f733bdbfd11489..396b55a9e32f5587f9bb2eaf01a5eba53e340cee 100644 (file)
@@ -123,7 +123,7 @@ out:
       else
         msg = "Invalid token";
 
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, msg);
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", msg);
 
       return NULL;
     }
@@ -291,7 +291,7 @@ session_get_login_token (SoupSession  *session,
       const char *detail = response_get_detail (response);
 
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   detail ? detail : soup_status_get_phrase (status));
+                   "%s", detail ? detail : soup_status_get_phrase (status));
       return NULL;
     }
 
@@ -354,7 +354,7 @@ session_upload_file (SoupSession  *session,
       const char *detail = response_get_detail (response);
 
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   detail ? detail : soup_status_get_phrase (status));
+                   "%s", detail ? detail : soup_status_get_phrase (status));
       return FALSE;
     }